Skip to content

feat: add MiniMax-M2.7 LLM support via official API#5

Open
octo-patch wants to merge 1 commit into432539:mainfrom
octo-patch:feat/minimax-m2.7
Open

feat: add MiniMax-M2.7 LLM support via official API#5
octo-patch wants to merge 1 commit into432539:mainfrom
octo-patch:feat/minimax-m2.7

Conversation

@octo-patch
Copy link
Copy Markdown

Summary

  • Add provider column to models table: empty = chatgpt.com legacy path, minimax = MiniMax official OpenAI-compatible API
  • Implement internal/upstream/minimax.Client with non-streaming Chat() and streaming StreamChat() methods
  • Route provider=minimax models in gateway.ChatCompletions without touching the chatgpt.com account scheduler
  • Add streamMiniMax() + extractMiniMaxDelta() for MiniMax's standard OpenAI delta-chunk SSE format
  • Expose and validate provider field in admin model CRUD API
  • DB migration 20260423000001 adds the provider column and seeds the MiniMax-M2.7 chat model
  • Config section minimax.api_key / minimax.base_url (env GPT2API_MINIMAX_API_KEY)

Test Plan

  • go build ./... — zero compilation errors
  • go test ./internal/upstream/minimax/... — 5 unit tests pass
  • go test ./internal/gateway/... — 3 tests pass

Usage

  1. Obtain a MiniMax API key from https://platform.minimaxi.com/
  2. Set in config: minimax.api_key: your-api-key
  3. Run DB migration (goose up)
  4. Call via standard OpenAI SDK with model=MiniMax-M2.7

- Add `provider` column to models table; empty = chatgpt.com (legacy),
  'minimax' = MiniMax official OpenAI-compatible API
- Add MiniMaxConfig to config (minimax.api_key / minimax.base_url)
- Implement internal/upstream/minimax.Client with non-streaming Chat()
  and streaming StreamChat() methods, both OpenAI-compatible
- Route provider=minimax models in gateway.ChatCompletions without
  touching the chatgpt.com account scheduler
- Add streamMiniMax() and extractMiniMaxDelta() for standard OpenAI
  delta-chunk SSE format (differs from chatgpt.com JSON-Patch SSE)
- Update admin model CRUD to expose and validate the provider field
- DB migration 20260423000001 adds provider column and seeds MiniMax-M2.7
- Unit tests: 8 tests covering client creation, non-stream/stream chat,
  error propagation, and gateway handler wiring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant